#ifndef PURE_URI_H_
#define PURE_URI_H_

#include "PureObject.h"

namespace Pure
{
    class URI : public Object
    {
    public:
        explicit URI(const char* uri);
        ~URI();
        
        /**
         * @enum Scheme
         * The scheme of the uri or unkown if a scheme cannot be determined.
         */
        enum Scheme
        {
            SCHEME_UNKNOWN = -1,
            SCHEME_FILE,
            SCHEME_HTTP,
            SCHEME_HTTPS,
            SCHEME_MAILTO,
            SCHEME_FTP,
            SCHEME_URN
        };
    
        /**
         * Return a null-terminated string containing the uri scheme.
         * @return A null-terminated string or NULL.
         */
        const char* getScheme();
        
        /**
         * Return a null-terminated string containing the host.
         * @return A null-terminated string or NULL.
         */
        const char* getHost();
        
        /**
         * Return a null-terminated string containing the path.
         * @return A null-terminated string or NULL.
         */
        const char* getPath();
        
        /**
         * Return a null-terminated string containing the username.
         * @return A null-terminated string or NULL.
         */
        const char* getUsername();
        
        /**
         * Return a null-terminated string containing the password.
         * @return A null-terminated string or NULL.
         */
        const char* getPassword();

        /**
         * Return a null-terminated string containing the query.
         * @return A null-terminated string or NULL.
         */
        const char* getQuery();
        
        /**
         * Return a null-terminated string containing the fragment (anchor).
         * @return A null-terminated string or NULL.
         */
        const char* getFragment();
        
        /**
         * Return the port.
         * @return An unsigned 16-bit integer. Defaults to the protocol default.
         */
        uint16_t getPort();
        
    private:
        /** Private data struct. **/
        struct Private;
        Private* mPrivateData;
        
        /*
         * Parse the given uri into each part.
         */
        void parse();
    };
    
} // end namespace Pure

#endif /*PURE_URI_H_*/
